<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('营销人员预授信情况列表')"/>
</head>
<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
    <form class="form-horizontal" id="formUserPriorCredit">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <h3 style="margin-bottom: 5px; color: red; text-align: center">营销人员预授信业务排名</h3>
                <form>
                    <div class="select-list">
                        <ul>
                            <li>
                                <label>机构名称：</label>
                                <input name="deptId" type="hidden" id="treeIdUserPriorCredit"/>
                                <input name="deptName" onclick="selectDeptTreeUserPriorCredit()" id="treeNameUserPriorCredit" type="text"
                                       placeholder="请选择归属机构" autocomplete="off">
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="searchUserPriorCredit()"><i
                                        class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="resetUserPriorCredit()"><i
                                        class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>
            <div class="btn-group-sm" id="toolbarUserPriorCredit" role="group">
                <a class="btn btn-warning" onclick="exportExcelUserPriorCredit()"
                   shiro:hasPermission="merchant:branchPriorCreditUser:export">
                    <i class="fa fa-download"></i> 导出
                </a>
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table-userPriorCredit"></table>
            </div>
        </div>
    </form>
    <form class="form-horizontal" id="formUserAnthropoidsPriorCredit">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <h3 style="margin-bottom: 5px; color: red; text-align: center">个人客户-预授信营销人员排名</h3>
                <form>
                    <div class="select-list">
                        <ul>
                            <li>
                                <label>机构名称：</label>
                                <input name="deptId" type="hidden" id="treeIdUserAnthropoidsPriorCredit"/>
                                <input name="deptName" onclick="selectDeptTreeUserAnthropoidsPriorCredit()" id="treeNameUserAnthropoidsPriorCredit" type="text"
                                       placeholder="请选择归属机构" autocomplete="off">
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="searchUserAnthropoidsPriorCredit()"><i
                                        class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="resetUserAnthropoidsPriorCredit()"><i
                                        class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>
            <div class="btn-group-sm" id="toolbarUserAnthropoidsPriorCredit" role="group">
                <a class="btn btn-warning" onclick="exportExcelUserAnthropoidsPriorCredit()"
                   shiro:hasPermission="merchant:branchPriorCreditUser:export">
                    <i class="fa fa-download"></i> 导出
                </a>
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table-userAnthropoidsPriorCredit"></table>
            </div>
        </div>
    </form>
    <form class="form-horizontal" id="formUserMerchantPriorCredit">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <h3 style="margin-bottom: 5px; color: red; text-align: center">商户客户-预授信营销人员排名</h3>
                <form>
                    <div class="select-list">
                        <ul>
                            <li>
                                <label>机构名称：</label>
                                <input name="deptId" type="hidden" id="treeIdUserMerchantPriorCredit"/>
                                <input name="deptName" onclick="selectDeptTreeUserMerchantPriorCredit()" id="treeNameUserMerchantPriorCredit" type="text"
                                       placeholder="请选择归属机构" autocomplete="off">
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="searchUserMerchantPriorCredit()"><i
                                        class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="resetUserMerchantPriorCredit()"><i
                                        class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>
            <div class="btn-group-sm" id="toolbarUserMerchantPriorCredit" role="group">
                <a class="btn btn-warning" onclick="exportExcelUserMerchantPriorCredit()"
                   shiro:hasPermission="merchant:branchPriorCreditUser:export">
                    <i class="fa fa-download"></i> 导出
                </a>
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table-userMerchantPriorCredit"></table>
            </div>
        </div>
    </form>
</div>

<th:block th:include="include :: footer"/>
<script type="text/javascript">
    var prefix = ctx + "merchant/priorChart";

    $(function () {
        /*各营销人员预授信业务排名*/
        var userPriorCreditOptions = {
            id: 'bootstrap-table-userPriorCredit',
            toolbar: 'toolbarUserPriorCredit',
            formId: 'formUserPriorCredit',
            url: prefix + "/getUserPriorCreditList",
            exportUrl: prefix + "/exportUserPriorCreditList",
            modalName: "各营销人员预授信业务排名",
            columns: [
                {
                    field: 'userName',
                    title: '客户经理'
                },
                {
                    field: 'rank',
                    title: '额度排名',
                    align: "center",
                },
                {
                    field: 'priorCreditLimit',
                    title: '预授信总额度（万）',
                    sortable: true,
                    formatter: function (value, row, index) {
                        return $.table.formatNumber(value);
                    }
                },
                {
                    field: 'lastMouthPriorCreditLimit',
                    title: '上月新增（万）',
                    sortable: true,
                    formatter: function (value, row, index) {
                        return $.table.formatNumber(value);
                    }
                },
                {
                    field: 'thisMouthPriorCreditLimit',
                    title: '本月新增（万）',
                    sortable: true,
                    formatter: function (value, row, index) {
                        return $.table.formatNumber(value);
                    }
                },
                {
                    field: 'comparePriorCreditLimit',
                    title: '较上月对比（万）',
                    sortable: true,
                    formatter: function (value, row, index) {
                        return $.table.formatNumber(value);
                    }
                },
                {
                    field: 'priorCreditNum',
                    title: '预授信总户数',
                    sortable: true,
                    formatter: function (value, row, index) {
                        return $.table.formatNumber(value);
                    }
                },
                {
                    field: 'numRank',
                    title: '户数排名',
                    align: "center",
                },
                {
                    field: 'deptName',
                    title: '归属机构'
                }]
        };
        $.table.init(userPriorCreditOptions);
        /*各营销人员个人预授信业务排名*/
        var userAnthropoidsPriorCreditOptions = {
            id: 'bootstrap-table-userAnthropoidsPriorCredit',
            toolbar: 'toolbarUserAnthropoidsPriorCredit',
            formId: 'formUserAnthropoidsPriorCredit',
            url: prefix + "/getUserAnthropoidsPriorCreditList",
            exportUrl: prefix + "/exportUserAnthropoidsPriorCreditList",
            modalName: "各营销人员个人预授信业务排名",
            columns: [
                {
                    field: 'userName',
                    title: '客户经理'
                },
                {
                    field: 'rank',
                    title: '额度排名',
                    align: "center",
                },
                {
                    field: 'priorCreditLimit',
                    title: '预授信总额度（万）',
                    sortable: true,
                    formatter: function (value, row, index) {
                        return $.table.formatNumber(value);
                    }
                },
                {
                    field: 'lastMouthPriorCreditLimit',
                    title: '上月新增（万）',
                    sortable: true,
                    formatter: function (value, row, index) {
                        return $.table.formatNumber(value);
                    }
                },
                {
                    field: 'thisMouthPriorCreditLimit',
                    title: '本月新增（万）',
                    sortable: true,
                    formatter: function (value, row, index) {
                        return $.table.formatNumber(value);
                    }
                },
                {
                    field: 'comparePriorCreditLimit',
                    title: '较上月对比（万）',
                    sortable: true,
                    formatter: function (value, row, index) {
                        return $.table.formatNumber(value);
                    }
                },
                {
                    field: 'priorCreditNum',
                    title: '预授信总户数',
                    sortable: true,
                    formatter: function (value, row, index) {
                        return $.table.formatNumber(value);
                    }
                },
                {
                    field: 'numRank',
                    title: '户数排名',
                    align: "center",
                },
                {
                    field: 'deptName',
                    title: '归属机构'
                }]
        };
        $.table.init(userAnthropoidsPriorCreditOptions);
        /*各营销人员商户预授信业务排名*/
        var userMerchantPriorCreditOptions = {
            id: 'bootstrap-table-userMerchantPriorCredit',
            toolbar: 'toolbarUserMerchantPriorCredit',
            formId: 'formUserMerchantPriorCredit',
            url: prefix + "/getUserMerchantPriorCreditList",
            exportUrl: prefix + "/exportUserMerchantPriorCreditList",
            modalName: "各营销人员商户预授信业务排名",
            columns: [
                {
                    field: 'userName',
                    title: '客户经理'
                },
                {
                    field: 'rank',
                    title: '额度排名',
                    align: "center",
                },
                {
                    field: 'priorCreditLimit',
                    title: '预授信总额度（万）',
                    sortable: true,
                    formatter: function (value, row, index) {
                        return $.table.formatNumber(value);
                    }
                },
                {
                    field: 'lastMouthPriorCreditLimit',
                    title: '上月新增（万）',
                    sortable: true,
                    formatter: function (value, row, index) {
                        return $.table.formatNumber(value);
                    }
                },
                {
                    field: 'thisMouthPriorCreditLimit',
                    title: '本月新增（万）',
                    sortable: true,
                    formatter: function (value, row, index) {
                        return $.table.formatNumber(value);
                    }
                },
                {
                    field: 'comparePriorCreditLimit',
                    title: '较上月对比（万）',
                    sortable: true,
                    formatter: function (value, row, index) {
                        return $.table.formatNumber(value);
                    }
                },
                {
                    field: 'priorCreditNum',
                    title: '预授信总户数',
                    sortable: true,
                    formatter: function (value, row, index) {
                        return $.table.formatNumber(value);
                    }
                },
                {
                    field: 'numRank',
                    title: '户数排名',
                    align: "center",
                },
                {
                    field: 'deptName',
                    title: '归属机构'
                }]
        };
        $.table.init(userMerchantPriorCreditOptions);
    })

    /*各营销人员预授信业务排名相关处理开始*/
    function searchUserPriorCredit() {
        table.set('bootstrap-table-userPriorCredit');
        $.table.search('formUserPriorCredit');
    }

    /* 选择机构树 */
    function selectDeptTreeUserPriorCredit() {
        var treeIdUserPriorCredit = $("#treeIdUserPriorCredit").val();
        var deptId = $.common.isEmpty(treeIdUserPriorCredit) ? "100" : $("#treeIdUserPriorCredit").val();
        var url = ctx + "system/dept/selectDeptTree/" + deptId;
        var options = {
            title: '选择部门',
            width: "380",
            url: url,
            callBack: doSubmitUserPriorCredit
        };
        $.modal.openOptions(options);
    }
    function doSubmitUserPriorCredit(index, layero) {
        var body = $.modal.getChildFrame(index);
        $("#treeIdUserPriorCredit").val(body.find('#treeId').val());
        $("#treeNameUserPriorCredit").val(body.find('#treeName').val());
        $.modal.close(index);
    }
    function exportExcelUserPriorCredit() {
        table.set('bootstrap-table-userPriorCredit');
        $.table.exportExcel('formUserPriorCredit');
    }
    function resetUserPriorCredit() {
        table.set('bootstrap-table-userPriorCredit');
        $('#treeIdUserPriorCredit').val('')
        $.form.reset('formUserPriorCredit');
    }
    /*各营销人员预授信业务排名相关处理结束*/

    /*各营销人员个人预授信业务排名相关处理开始*/
    function searchUserAnthropoidsPriorCredit() {

        table.set('bootstrap-table-userAnthropoidsPriorCredit');
        $.table.search('formUserAnthropoidsPriorCredit');
    }

    /* 选择机构树 */
    function selectDeptTreeUserAnthropoidsPriorCredit() {
        var treeIdUserAnthropoidsPriorCredit = $("#treeIdUserAnthropoidsPriorCredit").val();
        var deptId = $.common.isEmpty(treeIdUserAnthropoidsPriorCredit) ? "100" : $("#treeIdUserAnthropoidsPriorCredit").val();
        var url = ctx + "system/dept/selectDeptTree/" + deptId;
        var options = {
            title: '选择部门',
            width: "380",
            url: url,
            callBack: doSubmitUserAnthropoidsPriorCredit
        };
        $.modal.openOptions(options);
    }
    function doSubmitUserAnthropoidsPriorCredit(index, layero) {
        var body = $.modal.getChildFrame(index);
        $("#treeIdUserAnthropoidsPriorCredit").val(body.find('#treeId').val());
        $("#treeNameUserAnthropoidsPriorCredit").val(body.find('#treeName').val());
        $.modal.close(index);
    }
    function exportExcelUserAnthropoidsPriorCredit() {
        table.set('bootstrap-table-userAnthropoidsPriorCredit');
        $.table.exportExcel('formUserAnthropoidsPriorCredit');
    }
    function resetUserAnthropoidsPriorCredit() {
        table.set('bootstrap-table-userAnthropoidsPriorCredit');
        $('#treeIdUserAnthropoidsPriorCredit').val('')
        $.form.reset('formUserAnthropoidsPriorCredit');
    }
    /*各营销人员个人预授信业务排名相关处理结束*/

    /*各营销人员商户预授信业务排名相关处理开始*/
    function searchUserMerchantPriorCredit() {

        table.set('bootstrap-table-userMerchantPriorCredit');
        $.table.search('formUserMerchantPriorCredit');
    }

    /* 选择机构树 */
    function selectDeptTreeUserMerchantPriorCredit() {
        var treeIdUserMerchantPriorCredit = $("#treeIdUserMerchantPriorCredit").val();
        var deptId = $.common.isEmpty(treeIdUserMerchantPriorCredit) ? "100" : $("#treeIdUserMerchantPriorCredit").val();
        var url = ctx + "system/dept/selectDeptTree/" + deptId;
        var options = {
            title: '选择部门',
            width: "380",
            url: url,
            callBack: doSubmitUserMerchantPriorCredit
        };
        $.modal.openOptions(options);
    }
    function doSubmitUserMerchantPriorCredit(index, layero) {
        var body = $.modal.getChildFrame(index);
        $("#treeIdUserMerchantPriorCredit").val(body.find('#treeId').val());
        $("#treeNameUserMerchantPriorCredit").val(body.find('#treeName').val());
        $.modal.close(index);
    }
    function exportExcelUserMerchantPriorCredit() {
        table.set('bootstrap-table-userMerchantPriorCredit');
        $.table.exportExcel('formUserMerchantPriorCredit');
    }
    function resetUserMerchantPriorCredit() {
        table.set('bootstrap-table-userMerchantPriorCredit');
        $('#treeIdUserMerchantPriorCredit').val('')
        $.form.reset('formUserMerchantPriorCredit');
    }
    /*各营销人员商户预授信业务排名相关处理结束*/

</script>
</body>
</html>